package com.ghca.storm;

import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;

/**
 * Created by gh on 2016/10/24.
 */
public class WordCountTopology {

    public static void main(String[] args) {
        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("spout_id", new DataSourceSpout());
        builder.setBolt("spit_bolt_id", new SplitBolt()).shuffleGrouping("spout_id");
        builder.setBolt("wordcount_bolt_id", new WordCountBolt()).shuffleGrouping("spit_bolt_id");
        LocalCluster localCluster = new LocalCluster();
        Config config = new Config();
        config.setMaxTaskParallelism(1);
        localCluster.submitTopology(WordCountTopology.class.getSimpleName() + System.currentTimeMillis(),
                config, builder.createTopology());
    }
}
